<?php

/**
 * Request
 * @author liuch
 * @version 1.0
 * @date 2017-07-28 11:40
 */
class Request {

    private $url = 'https://3030.ij120.zoenet.cn';

    private $map = array(
        //获取用户信息
        'GetUserInfo' => 'api/user/getUserInfo',
        //获取门诊预约
        'GetScheduleList' => 'api/reservation/getScheduleList',
        //获取医生预约
        'GetScheduleDoctor' => 'api/reservation/getScheduleTime',
        //获取门诊信息
        'GetPrecontractDeptList' => 'api/reservation/getPrecontractDeptList',
        //获取用户预约信息列表
        'GetMyPrecontractList' => 'api/reservation/getMyPrecontractList',
        //获取时间
        'GetDays' => 'api/reservation/getDays',
        //用户预约
        'Do' => 'api/reservation/comfirmPrecontract',
    );

    public function getUrl($action, $params = []) {

        $query = $params ? '?' . http_build_query($params) : '';

        return $this->url . "/{$this->map[$action]}{$query}";
    }
}